// Author: wsfuyibing <682805@qq.com>
// Date: 2025-06-12

package responses

import (
	"server/app/http/models"
	"server/app/kind"
	"time"
)

// ArcadeLogsResponse
// 钓场日志.
type ArcadeLogsResponse struct {
	Id            int64
	ArcadeId      kind.ArcadeId
	UserId        kind.UserId
	Nickname      string
	Operation     kind.ArcadeAdminOperation
	OperationPage string
	OperationText string
	Params        string
	Content       string
	Datetime      string
	User          *UserResponse `json:",omitempty"`
}

// With
// 数据绑定.
func (o *ArcadeLogsResponse) With(m *models.ArcadeLogs) *ArcadeLogsResponse {
	o.Id = m.Id
	o.ArcadeId = m.ArcadeId
	o.UserId = m.UserId
	o.Nickname = m.Nickname
	o.Operation = m.Operation
	o.OperationPage = m.Operation.Page()
	o.OperationText = m.Operation.Text()
	o.Params = m.Params
	o.Content = m.Content
	o.Datetime = m.CreatedAt.Time().Format(time.DateTime)
	return o
}

// WithUser
// 绑定用户.
func (o *ArcadeLogsResponse) WithUser(m *models.Users) *ArcadeLogsResponse {
	if m != nil {
		o.User = (&UserResponse{}).With(m)
	}
	return o
}
